﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class info : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string userName = Context.User.Identity.Name;
        MySqlConnection con = DbUtils.getCon();
        MySqlCommand cmd = new MySqlCommand("select student.* from student where sname='" + userName + "'", con);
        MySqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            id.InnerText = dr["sid"].ToString();
            name.InnerText = dr["sname"].ToString();
            sex.InnerText = dr["sex"].ToString();
            profession.InnerText = dr["department"].ToString();
            grade.InnerText = dr["grade"].ToString();
        }
        else
        {
            id.InnerText = "201722110520165";
            name.InnerText = "段厚林";
            sex.InnerText = "男";
            profession.InnerText = "计科";
            grade.InnerText = "2017";
        }
        DbUtils.close(con, dr);
    }
}